feat: allow to get results as json#284
Conversation
What does this mean? Why did we need to ditch click for the output? |
| candidate_dependency: str | ||
| similar_dependencies: list[str] = field(default_factory=list) | ||
| dependency: str | ||
| similarities: list[str] = [] |
There was a problem hiding this comment.
Are these really similarities? Why the rename?
There was a problem hiding this comment.
Are these really similarities?
I think they are, no?
Why the rename?
I wanted to make it shorter for a better experience when working with the json.
I'm open to alternatives though!
There was a problem hiding this comment.
This is quite pedantic 😆 but to me similarities are "the attributes or qualities that make something like something else".
So in this example the similarities are the "shared letters", and the "something else" are the similar_depdendencies.
There was a problem hiding this comment.
would calling it similars work for you?
You can find here an example https://github.com/elementsinteractive/twyn/pull/284/files#diff-ae0b15b531bda07c4292b5e4d8acb8b370f8a2e8c511a85ba548ad7d4491cc22R245 click is not returning any output when we use EDIT: I've deleted a fixture that was causing this issue. Thanks for pointing out! |
Introduces
--jsonflag to return the results as a json.It no longer uses click.echo, for some reason it is not captured in the output and it's impossible to test.
Another important addition here is that
check_dependenciesnow returns an object of the new classTyposquatCheckResultList. This breaks previous implementations of those usingtwynas a package.It also renames
candidate_dependencytodependencyandsimilar_resultstosimilaritiesfrom theTyposquatCheckResultmodel.BREAKING CHANGE
closes #283